<template>
	<div class=" _wz_reading">
		<Card :bordered="true" style="margin:0 0 10px;">
			<p slot="title">搜索</p>
			<Form :model="formDataSearch" label-position="right" :label-width="100" inline>
				<FormItem label="从业人员">
					<i-input v-model="formDataSearch.driverName" placeholder="从业人员" clearable />
				</FormItem>
        <FormItem label="从业类型">
          <i-select v-model="formDataSearch.driverTypeCode" filterable placeholder="请选择从业类型" clearable>
            <Option v-for="item in personType" :value="item.code" :key="item.code">{{item.value}}</Option>
          </i-select>
        </FormItem>
				<FormItem label="签收状态">
					<i-select v-model="formDataSearch.noticeReadState" filterable placeholder="请选择签收状态" clearable>
						<Option value="0">未签收</Option>
						<Option value="1">已签收</Option>
					</i-select>
				</FormItem>
				<FormItem label="回复状态">
					<i-select v-model="formDataSearch.noticeReplyState" filterable placeholder="请选择回复状态" clearable>
						<Option value="0">未回复</Option>
						<Option value="1">已回复</Option>
					</i-select>
				</FormItem>
				<FormItem>
					<Button type="primary" @click="searchSubmit">搜索</Button>
				</FormItem>
			</Form>
		</Card>
		<Card dis-hover :bordered="true">
			<p slot="title">列表</p>
			<wzTbale ref="wzTbale" :tableData="tableData"></wzTbale>
		</Card>
	</div>
</template>
<script>
	import wzTbale from "../../../components/table/table";

	export default {
		props: ["selectData"],//接收来自父组件的数据
		components: {
			wzTbale,//列表
		},
		data() {
			return {
				personType: [],//从业类型
				formDataSearch: {
					noticeUuid: this.selectData.uuid
				},
				tableData: {
					url: this.apiUrl.webApi + "/notice/deptMessage/noticeDeptMessageRecordPageList",//请求地址
					method: 'post',//请求方式
					where: {noticeUuid: this.selectData.uuid},//搜索条件
					height: 'auto',//表格高度 auto
					page: true,//分页是否使用
					columns: [//表头数据
						{type: 'index', width: 70, align: 'center', title: '序号',},
						{title: '从业人员', minWidth: 100, key: 'driverName'},
						{title: '从业类型', minWidth: 100, key: 'driverTypeName'},
						{
							title: '签收时间', minWidth: 160, key: 'readTime', render: (h, params) => {
								var test = '';
								if (!!params.row.readTime) {
									test = h('span', {style: { "cursor": "pointer"},}, params.row.readTime)
								} else {
                  test = h('Tag', {props: {type: 'dot',color: 'error'}}, '未签收');
									// test = h('span', {style: {"color": "#ed4014", "cursor": "pointer"},}, "未签收")
								}
								return test;
							}
						},
						{
							title: '回复时间', minWidth: 160, key: 'replyTime', render: (h, params) => {
								var test = '';
								if (params.row.noticeReplyType == 0) {
                  test = h('Tag', { props: {type: 'dot', color: 'success'}}, '无需回复');
								} else {
									if (!!params.row.replyTime) {
										test = h('span', params.row.replyTime)
									} else {
                    test = h('Tag', {props: {type: 'dot',color: 'error'}}, '未回复');
										// test = h('span', {style: {"color": "#ed4014", "cursor": "pointer"},}, "未回复")
									}
								}
								return test;
							}
						},
						{
							title: '回复内容', minWidth: 260, key: 'replyContext', render: (h, params) => {
								var test = '';
								if (params.row.noticeReplyType == 0) {
                  test = h('Tag', { props: {type: 'dot', color: 'success'}}, '无需回复');
								} else {
									if (!!params.row.replyContext) {
										test = h('span', params.row.replyContext)
									} else {
                    test = h('Tag', {props: {type: 'dot',color: 'error'}}, '未回复');
										// test = h('span', {style: {"color": "#ed4014", "cursor": "pointer"}}, "未回复")
									}
								}
								return test;
							}
						},
					],
					format: {//返回数据格式
						list: ['data'],//数据list
						count: ['count'],//数据总量
					},
				},

			}
		},
		beforeCreate() {//beforeCreate创建前状态

		},
		created() {//created创建完毕状态

		},
		beforeMount() {//beforeMount挂载前状态   DOM 元素然后塞入页面的过程

		},
		mounted() {//mounted 挂载结束状态
			var that = this;
			//从业类型
			that.axios.post(that.apiUrl.systemDictSystemDictList, {type: 'person_type'}).then(res => {
				if (!!res) {
					that.personType = res.data.data;
				}
			}).catch(err => {
				console.log('失败', err);
			})
		},
		methods: {//执行的方法
			//搜索
			searchSubmit() {//搜索
				this.tableData.where = JSON.parse(JSON.stringify(this.formDataSearch));
				this.$refs.wzTbale.tableLoadData(true);
			},
		},
		watch: {//监听

		},

		beforeUpdate() {//beforeUpdate 更新前状态

		},
		updated() {//updated 更新完成状态

		},
		beforeDestroy() {//beforeDestroy 销毁前状态

		},
		destroyed() {//destroyed 销毁完成状态

		}
	}
</script>


<style lang="less">
	._wz_reading {
		height: 100%;


	}
</style>
